<template>
  <a-card :bordered="false">
    <a-table
      rowKey="id"
      :columns="columns"
      :dataSource="orderInfo"
      class="j-table-force-nowrap">

      <span slot="action" slot-scope="text, record">
           <router-link :to="{name:'/orderIndex',params: { record }}">事件记录</router-link>
      </span>
    </a-table>
  </a-card>
</template>

<script>
import PageLayout from '@/components/page/PageLayout'
import DetailList from '@/components/tools/DetailList'
import ABadge from "ant-design-vue/es/badge/Badge"
import { getAction } from '@api/manage'
const DetailListItem = DetailList.Item

export default {
  components: {
    PageLayout,
    ABadge,
    DetailList,
    DetailListItem,
  },
  data () {
    return {
      description: 'order管理页面',
      // 表头
      columns: [
        {
          title:'订单编号',
          align:"center",
          dataIndex: 'id'
        },
        {
          title:'医生名称',
          align:"center",
          dataIndex: 'doctorName'
        },
        {
          title:'创建时间',
          align:"center",
          dataIndex: 'createTime'
        },
        {
          title:'订单类型',
          align:"center",
          dataIndex: 'shopType',
          customRender:function (res) {
            let type;
            if(res == 1){
              type = "图文问诊";
            }else if(res == 2){
              type = "视频问诊";
            }
            return type;
          }
        },
        {
          title:'订单状态',
          align:"center",
          dataIndex: 'status',
          customRender:function (res) {
            let status;
            if(res == 0){
              status = "待接诊";
            }else if(res == 1){
              status = "进行中";
            }else if(res == 2){
              status = "确认中";
            } else if(res == 3){
              status = "结算中";
            } else if(res == 4){
              status = "已结算";
            }else if(res == 5){
              status = "退款";
            }else if(res == 6){
              status = "关闭";
            }
            return status;
          }
        },
        {
          title:'订单用户',
          align:"center",
          dataIndex: 'userName'
        },
        {
          title:'订单金额',
          align:"center",
          dataIndex: 'amount',
        },
        {
          title: '订单进度表',
          dataIndex: 'action',
          align:"center",
          fixed:"right",
          width:147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        queryOrder: "/order/order/queryById",
      },
      orderInfo:{},
    }
  },
  created() {
    this.getInfo(this.$route.params.id);
  },
  computed: {
    title () {
      return this.$route.meta.title
    }
  },
  methods: {
    //加载订单信息
    getInfo(id){
      let param = {};
      param.id = id;
      getAction(this.url.queryOrder,param).then(res=>{
        this.orderInfo = res.result;
      })
    },
  }

}
</script>

<style scoped>
@import '~@assets/less/common.less';
</style>